Loading TOC...

PUT /v1/ext/{directories}/{asset}

Summary

Install an asset such as a dependent library of an extension module in the modules database associated with this REST API instance. The asset is installed with the database URI /ext/{directories}/{asset}.

URL Parameters
format? Specify the asset document type for MarkLogic Server. Allowed values: xml, text, binary. This parameter only affects document type when there is no MIME type mapping defined for the asset URI extension or the Content-type. For details, see Controlling Input and Output Content Type in the REST Application Developer's Guide.
perm:{role}* Give the asset the specified permissions, in addition to the default rest-admin permissions that all assets have. Any existing permissions beyond the default are replaced. Example: perm:my-role=execute. Valid capability values: read, update, execute.
Request Headers
Content-type? The MIME type of the data in the request body.

Response

Upon successful completion, MarkLogic Server responds with status code 201 (Created) or 204 (Updated).

Required Privileges

This operation requires the rest-admin role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-admin

http://marklogic.com/xdmp/privileges/rest-reader

http://marklogic.com/xdmp/privileges/rest-writer

Usage Notes

/ext/{directories}/{asset} will be the document URI of the asset in the modules database, where {directories} is one or more database directory path steps, separated by "/", and {asset} is the asset document. See the example below.

The type of document inserted into the database (XML, JSON, text, or binary) is based on the MIME type mapping defined for the URI extension, the MIME type mapping defined for the Content-type, in that order of. precedence. For details, see Controlling Input and Output Content Type in the REST Application Developer's Guide.

For more details, see

See Also

Example

# Note: Use --data-binary instead of -d with curl if you need to preserve
# newlines in the input data. For example, when storing a JavaScript module
# module that uses line-oriented comments (//).

$ curl --anyauth --user user:password -X PUT -i -d @./my-lib.xqy \
    -H "Content-type: application/xquery"  \
    'http://localhost:8000/v1/ext/my/example/my-lib.xqy?perm:my-users=execute'

==> MarkLogic Server installs the XQuery library module that is in 
    the request body into the Modules database with the document 
    URI /ext/my/example/my-lib.xqy and returns a response similar
    to the following. The module is executable by users with the
    'my-users' role.

HTTP/1.1 201 Created
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.